<template>
  <div class="fns-dialog">
    <el-dialog
      title="dialog"
      :visible.sync="dialogVisible"
      width="40%"
      :close-on-click-modal="false">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px">
        <slot name="slot1"></slot>
        <fns-input  v-model="inputData[0].value" :params="inputData[0].params"></fns-input>

        <el-form-item label="账号" prop="val">
          <el-input  placeholder="请输入账号" v-model="val"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitForm">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import fnsInput from '@/components/input'
  export default {
    props: {
      formObj: {
        type: {}
      }
    },
    computed: {
    },
    watch: {
    },
    components: {
      fnsInput
    },
    data() {
      var val = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('输入有误'))
        }
      }
      return {
        dialogVisible: true,
        value: '',
        inputData: [
          {
            value: '',
            params: {
              label: '管理员',
              prop: 'value',
              placeholder: '请输入管理员',
              maxlength: 10,
              disabled: false,
              clearable: true
            }
          }
        ],
        params: {
          label: '管理员',
          prop: 'value',
          placeholder: '请输入管理员',
          maxlength: 10,
          disabled: false,
          clearable: true
        },
        ruleForm: {
          value: ''
        },
        val: '',
        rules: {
          value: [
            { required: true, message: '请输入管理员', trigger: 'blur' }
          ],
          val: { validator: val, trigger: 'blur' }
        }
      }
    },
    methods: {
      submitForm() {
        this.$emit('getVal')
        console.log(this.value1)
        console.log(321)
        console.log(this.inputData[0].value)
      }
    }
  }
</script>

<style lang="scss">
  .fns-dialog {
  .el-dialog {
    min-width: 780px;
  .el-form {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .el-dialog__body{
    padding:10px 20px 10px 20px !important;
  }
  .el-select {
    width: 100%;
  }
  }
  }
</style>
